/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * CandidatoRenderer.java
 *
 * Created on Apr 9, 2011, 8:05:30 PM
 */

package frontera.interfaz.listRenderer;

import entidad.Candidato;
import java.awt.Color;
import java.awt.Component;
import java.text.DecimalFormat;
import java.text.NumberFormat;
import javax.swing.JList;
import javax.swing.ListCellRenderer;
import org.pushingpixels.substance.api.SubstanceLookAndFeel;

/**
 *
 * @author tuareg
 */
public class ListRendererCandidato extends javax.swing.JPanel implements ListCellRenderer {

    /** Creates new form CandidatoRenderer */
    public ListRendererCandidato() {
        initComponents();
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        labelNombre = new javax.swing.JLabel();
        labelCedula = new javax.swing.JLabel();
        labelProfesion = new javax.swing.JLabel();
        labelEstado = new javax.swing.JLabel();
        labelAspiracionSalarial = new javax.swing.JLabel();
        labelCargo = new javax.swing.JLabel();

        setBackground(new java.awt.Color(255, 255, 255));
        setLayout(new java.awt.GridLayout());

        labelNombre.setText("nombre");
        add(labelNombre);

        labelCedula.setText("cedula");
        add(labelCedula);

        labelProfesion.setText("profesion");
        add(labelProfesion);

        labelEstado.setText("estado");
        add(labelEstado);

        labelAspiracionSalarial.setText("porcentajeSBasico");
        add(labelAspiracionSalarial);

        labelCargo.setText("cargo");
        add(labelCargo);
    }// </editor-fold>//GEN-END:initComponents


    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JLabel labelAspiracionSalarial;
    private javax.swing.JLabel labelCargo;
    private javax.swing.JLabel labelCedula;
    private javax.swing.JLabel labelEstado;
    private javax.swing.JLabel labelNombre;
    private javax.swing.JLabel labelProfesion;
    // End of variables declaration//GEN-END:variables

    public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
        
        Candidato c = (Candidato) value;

        labelNombre.setText(c.getNombre());
        labelCedula.setText(String.valueOf(c.getCedula()));
        labelProfesion.setText(c.getProfesion());
        labelAspiracionSalarial.setText(c.getAspiracionSalarial());
        labelEstado.setText(c.getEstado());
        labelCargo.setText(c.getAspiracionCargo().getNombre());

        if (isSelected)
            this.setBackground(new Color(232,232,252));
        else
            this.setBackground(new Color(255,255,255));
        return this;
    }

}
